package com.jwdemo
{
	import com.jwdemo.GameBitMaps;
	import com.jwdemo.TextureAnim;
	
	public class Explosion implements InfGameObject
	{
		private var animation:TextureAnim ;
		private var xpos:Number ;
		private var ypos:Number ;

		public function Explosion(xpos:Number,ypos:Number)
		{
			this.xpos		=	xpos ;
			this.ypos		=	ypos ;
			animation 		= 	new SpriteSheet(GameBitMaps.GetBitMap("bullethits"),32,32).createTextureAnimation(12) ;
			animation.play(false,false) ;
		}
		
		public function update(dt:Number):void
		{
			if (animation) {
				animation.update(dt) ;
			}
		}
		
		public function render(rHelper:RenderHelper):void
		{
			if (animation && isAlive())
			{
				var texInfo:Object = animation.getRenderTexture() ;
				rHelper.drawSheet(texInfo.sheet,xpos,ypos,texInfo.frame) ;

			}
			//rHelper.drawCircle(xpos,ypos,20) ;
		}
		
		public function applyDamage(damage:Number):void
		{
			
		}
		
		public function isAlive():Boolean
		{
			return animation && animation.isPlaying() ;
		}
	}
}